package com.lzj.demo.enums;

import lombok.AllArgsConstructor;

@AllArgsConstructor
public enum SexEnum  {
    BOY(1,"男"),
    GIRL(2,"女");
    private Integer code;
    private String desc;
    public Integer getCode() {
        return code;
    }
    public String getDesc() {
        return desc;
    }
    public static SexEnum getEnumByCode(Integer code) {
        for (SexEnum sexEnum : SexEnum.values()) {
            if (sexEnum.getCode().equals(code)) {
                return sexEnum;
            }
        }
        return null;
    }
}
